package com.blog.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author tcj
 * @date 2020/10/13 15:33
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("api文档")//标题
                        .description("博客后端api接口文档")//描述
                        .version("1.0")//版本
                        .build())
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com"))//contr的包（我这里因为是多模块所以嫌麻烦直接扫描com包）
                .paths(PathSelectors.any())
                .build();
    }



}
